public async Task SaveItem(MpGroupItemDto input)
        {
            if (input.MotherType == MotherType.ALL.ToString())
            {
                input.BeginBabyBirthday = new DateTime(1900, 1, 1);
                input.EndBabyBirthday   = new DateTime(1900, 1, 1);
            }
            else if (input.MotherType == MotherType.UnPregnant.ToString())
            {
                DateTime date = DateTime.Now.AddDays(280);
                input.BeginBabyBirthday = date;
                input.EndBabyBirthday   = new DateTime(1900, 1, 1);
            }
            else if (input.MotherType == MotherType.Pregnant.ToString())
            {
                DateTime date = DateTime.Now.AddDays(280);
                input.BeginBabyBirthday = DateTime.Now;
                input.EndBabyBirthday   = date;
            }
            else if (input.MotherType == MotherType.One.ToString())
            {
                DateTime date = DateTime.Now.AddDays(-180);
                input.BeginBabyBirthday = date;
                input.EndBabyBirthday   = DateTime.Now;
            }
            else if (input.MotherType == MotherType.Two.ToString())
            {
                DateTime date  = DateTime.Now.AddDays(-365);
                DateTime date2 = DateTime.Now.AddDays(-180);
                input.BeginBabyBirthday = date;
                input.EndBabyBirthday   = date2;
            }
            else if (input.MotherType == MotherType.Three.ToString())
            {
                DateTime date  = DateTime.Now.AddDays(-730);
                DateTime date2 = DateTime.Now.AddDays(-365);
                input.BeginBabyBirthday = date;
                input.EndBabyBirthday   = date2;
            }
            else if (input.MotherType == MotherType.Four.ToString())
            {
                DateTime date = DateTime.Now.AddDays(-730);
                input.BeginBabyBirthday = new DateTime(1900, 1, 1);
                input.EndBabyBirthday   = date;
            }

            await _mpGroupItemRepository.InsertOrUpdateAndGetIdAsync(ObjectMapper.Map <MpGroupItem>(input));
        }
Exemple #2
0
 public CreateOrEditMpGroupItemViewModel(MpGroupItemDto output)
 {
     output.MapTo(this);
 }