This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Table("Employees")] | |
public class Employee | |
{ | |
[PrimaryKey, AutoIncrement] | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public string LastName { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DatePickerFragment : DialogFragment, DatePickerDialog.IOnDateSetListener | |
{ | |
public static readonly string TAG = "X:" + typeof(DatePickerFragment).Name.ToUpper(); | |
Action<DateTime> _dateSelectedHandler = delegate { }; | |
public DatePickerFragment(Action<DateTime> onDateSelected) | |
{ | |
_dateSelectedHandler = onDateSelected; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void _btnSelectDate_Click(object sender, EventArgs e) | |
{ | |
new DatePickerFragment(delegate(DateTime time) | |
{ | |
_selectedDate = time; | |
_btnSelectDate.Text = _selectedDate.ToLongDateString(); | |
}) | |
.Show(FragmentManager, DatePickerFragment.TAG); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnSaveInstanceState(Bundle outState) | |
{ | |
var tabSelectedPosition = this.ActionBar.SelectedNavigationIndex; | |
outState.PutInt("selectedTabPosition", tabSelectedPosition); | |
base.OnSaveInstanceState(outState); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnRestoreInstanceState(Bundle savedInstanceState) | |
{ | |
base.OnRestoreInstanceState(savedInstanceState); | |
var previouslySelectedTabPosition = savedInstanceState.GetInt("selectedTabPosition", 0); | |
this.ActionBar.SetSelectedNavigationItem(previouslySelectedTabPosition); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<EditText | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:id="@+id/inputEventName" | |
android:fadingEdge="none" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Car | |
{ | |
public int Id { get; set; } | |
public string Producer { get; set; } | |
public string Model { get; set; } | |
public DateTime ProductionDate { get; set; } | |
public bool IsOnWarranty { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CarServiceContext : DbContext | |
{ | |
// DB connection properties injected automatically | |
public CarServiceContext() {} | |
// DB connection properties given explicitly (for Unit Tests) | |
public CarServiceContext(DbContextOptions options) : base(options) { } | |
public DbSet<Car> Cars { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Logging": { | |
"IncludeScopes": false, | |
"Debug": { | |
"LogLevel": { | |
"Default": "Warning" | |
} | |
}, | |
"Console": { | |
"LogLevel": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddDbContext<CarServiceContext>(o => | |
o.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); | |
services.AddMvc(); | |
} |