public ServicesResult SendDocuments(VmDocSendPost docSendmodel) { try { foreach (var doc in docSendmodel.DocIds) { foreach (var recivers in docSendmodel.Recivers) { var newsSendRecord = new DomainLayer.DB_Model.Send.Send() { DocId = Guid.Parse(doc), OwnerUserId = Guid.Parse(docSendmodel.OwnerUserId), SendDescription = docSendmodel.Description, ReceverEmployeeId = Guid.Parse(recivers.ReceiverPrsId), ReceverDepartmentId = Guid.Parse(recivers.ReceiverFolIds), SenderEmployeeId = Guid.Parse(docSendmodel.OwnerUserId), }; newsSendRecord.FolderId = _chartService.GetFolders(Guid.Parse(recivers.ReceiverFolIds), ChartEnumerable.FolderType.Inbox).ChartId; newsSendRecord.SenderDepartmentId = _chartService.GetDepartment(Guid.Parse(docSendmodel.Folid)).ChartId; _sendService.CreateNewSend(newsSendRecord); } } return(new ServicesResult() { Success = true, Message = "اسناد با موفقیت ارسال شد", }); } catch (Exception ex) { return(new ServicesResult() { Success = false, Message = ex.Message, InnerExeption = ex.InnerException.Message, }); } }
public ActionResult SendDocument(VmDocSendPost docSendModel) { if (Request.IsAjaxRequest()) { docSendModel.OwnerUserId = User.Identity.GetUserId(); var result = _docSendService.SendDocuments(docSendModel); if (result.Success) { return(Json(new { result = "ok" }, JsonRequestBehavior.AllowGet)); } throw new InvalidOperationException($"Server Error : {result.Message}"); } throw new InvalidOperationException(" is not Valid Method Type Method Is Ajax "); }