/// <summary>
 /// 修改一期劳保
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public async Task UpdateLaborHeadAsync(EditLaborHeadViewModel model)
 {
     await _laborHeadRepository.EditAsync(new LaborHead()
     {
         Id         = model.Id,
         Goods      = model.Goods,
         Options    = model.Options,
         UpdateTime = DateTime.Now,
         Title      = model.Title
     });
 }
Ejemplo n.º 2
0
 public async Task <IActionResult> CreateLaborHead(EditLaborHeadViewModel model)
 {
     if (await _laborHeadService.CreateLaborHeadAsync(model))
     {
         return(Ok());
     }
     else
     {
         return(BadRequest("同期已存在相同选项的劳保"));
     }
 }
        /// <summary>
        /// 新建劳保
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <bool> CreateLaborHeadAsync(EditLaborHeadViewModel model)
        {
            if (await _laborHeadRepository.GetAll().AnyAsync(m => m.Title == model.Title))
            {
                return(false);
            }
            else
            {
                await _laborHeadRepository.CreateAsync(new LaborHead()
                {
                    Title   = model.Title,
                    Options = model.Options,
                    Goods   = model.Goods
                });

                return(true);
            }
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> UpdateLaborHead(EditLaborHeadViewModel model)
        {
            await _laborHeadService.UpdateLaborHeadAsync(model);

            return(Ok());
        }