public void UpdateAttachment(int?id) { IServiceDataModel dataModel = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.Attachment); if (id != 0) { string source = this.Session["Source"] == null ? "" : this.Session["Source"].ToString(); IEnumerable <AttachmentModel> attachments = ServiceSystem.GetAttachments(source, "0"); if (attachments != null) { foreach (AttachmentModel attachment in attachments) { attachment.SourceFormId = id?.ToString(); attachment.SourceForm = "CapaPlan"; dataModel.Update(attachment); } } } else { string[] arr = this.Request.Form.GetValues("Removed"); if (arr != null) { foreach (string path in arr) { AttachmentModel attachment = dataModel.GetItem(string.Format("FilePath =\"{0}\"", HttpUtility.UrlDecode(path)), "Id"); if (attachment != null) { dataModel.Delete(attachment); } } } } }
public ActionResult RigAssetRelationUpdate(RigAssetRelationModel model) { RigAdminManageModel manageRigModel = (RigAdminManageModel)Session["RigAdminManageModel"]; if (ModelState.IsValid) { IServiceDataModel rigRelation = ServiceSystem.GetServiceModel(EnscoConstants.EntityModel.RigAssetRelation); if (rigRelation != null) { model.RigId = UtilitySystem.Settings.RigId; rigRelation.Update(model); } } return(PartialView("RigAdminAssetsPartial", manageRigModel)); }