public JsonResult AddUpdateSupportDocMessageImplementation(SupportDocMessageImplementationModel model)
 {
     if (ModelState.IsValid)
     {
         return(Json(SupportDocMessageImplementationService.Instance.SaveSupportDocMessageImplementation(model, GetUserInfo().iUserId)));
     }
     else
     {
         return(Json(new { Status = false, Message = string.Join(",", ModelState.Values.SelectMany(z => z.Errors).Select(z => z.ErrorMessage)) }));
     }
 }
Beispiel #2
0
 //save SupportDocMessageImplementation
 public object SaveSupportDocMessageImplementation(SupportDocMessageImplementationModel model, int iUserId)
 {
     try
     {
         using (var db = new SeaManifestEntities())
         {
             var data = db.tblSupportDocMessageImplementationMaps.Where(z => z.iSupportDocsId == model.iSupportDocsId).SingleOrDefault();
             if (data != null)
             {
                 data.iMessageImplementationId = model.iMessageImplementationId;
                 data.sTagRef         = model.sTagRef;
                 data.sRefSerialNo    = model.sRefSerialNo;
                 data.sSubSerialNoRef = model.sSubSerialNoRef;
                 data.sIcegateUserId  = model.sIcegateUserId;
                 data.sIRNNo          = model.sIRNNo;
                 data.sDocRefNo       = model.sDocRefNo;
                 data.sDocTypeCd      = model.sDocTypeCd;
                 data.sBeneficiaryCd  = model.sBeneficiaryCd;
                 data.iActionBy       = iUserId;
                 data.dtActionDate    = DateTime.Now;
                 db.Entry(data).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
             }
             else
             {
                 data = new tblSupportDocMessageImplementationMap
                 {
                     iMessageImplementationId = model.iMessageImplementationId,
                     sTagRef         = model.sTagRef,
                     sRefSerialNo    = model.sRefSerialNo,
                     sSubSerialNoRef = model.sSubSerialNoRef,
                     sIcegateUserId  = model.sIcegateUserId,
                     sIRNNo          = model.sIRNNo,
                     sDocRefNo       = model.sDocRefNo,
                     sDocTypeCd      = model.sDocTypeCd,
                     sBeneficiaryCd  = model.sBeneficiaryCd,
                     iActionBy       = iUserId,
                     dtActionDate    = DateTime.Now,
                 };
                 db.tblSupportDocMessageImplementationMaps.Add(data);
                 db.SaveChanges();
             }
             return(new { Status = true, Message = "Support Doc saved successfully!" });
         }
     }
     catch (Exception)
     {
         return(new { Status = false, Message = "Something went wrong" });
     }
 }