// 值班认领 上传现场服务照片 public int SubmitImg(MyDutySignImgAddModel AddViewModel) { int c = 0; MydutyClaim_Sign model = new MydutyClaim_Sign(); model.id = Guid.NewGuid().ToString(); model.Userid = AddViewModel.uid; model.UserName = AddViewModel.name; model.type = "img"; model.CheckTime = DateTime.Now; model.CreateUser = AddViewModel.uid; model.CreateDate = DateTime.Now; model.MydutyClaim_InfoID = AddViewModel.MydutyClaim_InfoID; model.OndutyClaims_InfoId = AddViewModel.OndutyClaims_InfoId; _mydutyClaim_Sign.Add(model); int count = _mydutyClaim_Sign.SaveChanges(); var AttachmentInfo = _IMapper.Map <List <VAttachmentAddViewModel>, List <VAttachment> >(AddViewModel.VAttachmentAddList); foreach (var item in AttachmentInfo) { item.ID = Guid.NewGuid().ToString(); item.formid = model.id; item.type = "ZBTP";//值班信息图片 item.Status = "0"; item.CreateUser = AddViewModel.uid; item.CreateDate = DateTime.Now; _vAttachmentRepository.Add(item); c = _vAttachmentRepository.SaveChanges() + c; } return(c); }
public ActionResult <BaseViewModel> MyDutySign_SubmitImg(MyDutySignImgAddModel AddViewModel) { BaseViewModel AddResModel = new BaseViewModel(); if (!String.IsNullOrEmpty(AddViewModel.uid) || !String.IsNullOrEmpty(AddViewModel.MydutyClaim_InfoID)) { int Add_Count = mydutyClaimInfoService.SubmitImg(AddViewModel); if (Add_Count >= 1) { AddResModel.Message = "上传成功"; AddResModel.ResponseCode = 200; } else { AddResModel.Message = "上传失败"; AddResModel.ResponseCode = 400; } } else { AddResModel.Message = "参数为空,上传失败"; AddResModel.ResponseCode = 500; } return(Ok(AddResModel)); }