public JsonResult AddUpdateAdditionalDetailsHouseCargo(AdditionalDetailsHouseCargoModel model)
 {
     if (ModelState.IsValid)
     {
         return(Json(AdditionalDetailsHouseCargoService.Instance.SaveAdditionalDetailsHouseCargo(model, GetUserInfo().iUserId)));
     }
     else
     {
         return(Json(new { Status = false, Message = string.Join(",", ModelState.Values.SelectMany(z => z.Errors).Select(z => z.ErrorMessage)) }));
     }
 }
Пример #2
0
 //save AdditionalDetailsHouseCargo
 public object SaveAdditionalDetailsHouseCargo(AdditionalDetailsHouseCargoModel model, int iUserId)
 {
     try
     {
         using (var db = new SeaManifestEntities())
         {
             var data = db.tblAdditionalDetailsHouseCargoMaps.Where(z => z.iAdditionalDetailsId == model.iAdditionalDetailsId).SingleOrDefault();
             if (data != null)
             {
                 data.iHouseCargoDescId = model.iHouseCargoDescId;
                 data.sTagRef           = model.sTagRef;
                 data.dRefSerialNo      = model.dRefSerialNo;
                 data.sInfoType         = model.sInfoType;
                 data.sInfoQualifier    = model.sInfoQualifier;
                 data.sInfoCd           = model.sInfoCd;
                 data.sInfoText         = model.sInfoText;
                 data.sInfoMsr          = model.sInfoMsr;
                 data.dtInfoDate        = model.sInfoDate.ToDate();
                 data.iActionBy         = iUserId;
                 data.dtActionDate      = DateTime.Now;
                 db.Entry(data).State   = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
             }
             else
             {
                 data = new tblAdditionalDetailsHouseCargoMap
                 {
                     iHouseCargoDescId = model.iHouseCargoDescId,
                     sTagRef           = model.sTagRef,
                     dRefSerialNo      = model.dRefSerialNo,
                     sInfoType         = model.sInfoType,
                     sInfoQualifier    = model.sInfoQualifier,
                     sInfoCd           = model.sInfoCd,
                     sInfoText         = model.sInfoText,
                     sInfoMsr          = model.sInfoMsr,
                     dtInfoDate        = model.sInfoDate.ToDate(),
                     iActionBy         = iUserId,
                     dtActionDate      = DateTime.Now,
                 };
                 db.tblAdditionalDetailsHouseCargoMaps.Add(data);
                 db.SaveChanges();
             }
             return(new { Status = true, Message = "Additional Details saved successfully!" });
         }
     }
     catch (Exception)
     {
         return(new { Status = false, Message = "Something went wrong" });
     }
 }