public MaterialDaycardViewModel(MaterialDaycardModel daycard, DayViewModel dayView)
 {
     Title     = daycard.Title;
     Quantity  = daycard.Quantity;
     DayUrl    = dayView;
     IdDaycard = daycard.Id;
 }
        public async Task SaveUpdatedDaycardAsync(DaycardType type, object daycardItem)
        {
            switch (type)
            {
            case DaycardType.Accomplishment:
                var model    = (AccomplishmentDaycardViewModel)daycardItem;
                var newModel = new AccomplishmentDaycardModel {
                    Id = model.IdDaycard, Date = model.DayUrl.Date, Quantity = model.Quantity, Title = model.Title
                };
                await database.InsertAsync(newModel);

                break;

            case DaycardType.Cost:
                var modelCost    = (CostDaycardViewModel)daycardItem;
                var newModelCost = new CostDaycardModel {
                    Id = modelCost.IdDaycard, Date = modelCost.DayUrl.Date, Title = modelCost.Title, TotalCost = modelCost.TotalCost
                };
                await database.InsertAsync(newModelCost);

                break;

            case DaycardType.Equipment:
                var modelEquipment    = (EquipmentDaycardViewModel)daycardItem;
                var newModelEquipment = new EquipmentDaycardModel {
                    Id = modelEquipment.IdDaycard, Date = modelEquipment.DayUrl.Date, Hours = modelEquipment.Hours, Miles = modelEquipment.Miles, Operator = modelEquipment.Operator, Title = modelEquipment.Title
                };
                await database.InsertAsync(newModelEquipment);

                break;

            case DaycardType.Labor:
                var modelLabor    = (LaborDaycardViewModel)daycardItem;
                var newModelLabor = new LaborDaycardModel {
                    Id = modelLabor.IdDaycard, Date = modelLabor.DayUrl.Date, Title = modelLabor.Title, Hours = modelLabor.Hours, TimeReportingCode = modelLabor.TimeReportingCode
                };
                await database.InsertAsync(newModelLabor);

                break;

            case DaycardType.Material:
                var modelMaterial    = (MaterialDaycardViewModel)daycardItem;
                var newModelMaterial = new MaterialDaycardModel {
                    Id = modelMaterial.IdDaycard, Date = modelMaterial.DayUrl.Date, Title = modelMaterial.Title, Quantity = modelMaterial.Quantity
                };
                await database.InsertAsync(newModelMaterial);

                break;
            }
        }