//public PartialViewResult GetStorageByID(string locationID) //{ // List<tbl_Storage> storageGetById = StorageBL.GetByID(locationID); // return PartialView("~/Views/Storage/Partial/_StorageDetailsPartial.cshtml", storageGetById); //} public string InsertOrUpdateStorage(LocationStorageModel LSM) { tbl_Storage storage = new tbl_Storage(); storage.LocationID = LSM.LocationID; storage.StorageID = LSM.StorageID; return(StorageBL.InsertOrUpdate(storage)); }
/// <summary> /// Delete storage by storage model /// </summary> /// <param name="storage"></param> /// <returns></returns> public bool DeleteByLocationDetails(tbl_Storage storage) { try { Context.Storage.Delete(storage); Context.Storage.Save(); return(true); } catch (Exception ex) { //POS Log Exception to db table return(false); } finally { // Context = null; } }
/// <summary> /// Update storage by storage model /// </summary> /// <param name="storage"></param> /// <returns></returns> public string Update(tbl_Storage storage) { try { Context.Storage.Update(storage); Context.Storage.Save(); return(storage.StorageID + "," + storage.LocationID + " Updated Successfully!!"); } catch (Exception ex) { //POS Log Exception to db table return("Error in saving details, Please try again!!"); } finally { // Context = null; } }
/// <summary> /// Insert or Update in tbl_Storage table -Vinod /// </summary> /// <param name="storage"></param> /// <returns></returns> public string InsertOrUpdate(tbl_Storage storage) { if (storage.StorageID == "D") { storage.StorageName = StorageEnum.Display.ToString(); } else if (storage.StorageID == "S") { storage.StorageName = StorageEnum.Store.ToString(); } storage.StorageType = string.Empty; List <tbl_Storage> CurrentStorage = this.GetByParamId(storage.LocationID.Trim(), storage.StorageID.Trim()); string result = string.Empty; if (CurrentStorage == null || CurrentStorage.Count == 0) { return(result = this.Insert(storage)); } else { //return result = this.Update(storage); } return(result); }