public IActionResult CreateHouseAddress(TblHouseAddress model) { try { return(Ok(fp.CreateHouseAddress(model))); } catch (Exception ex) { Exceptions(ex); return(StatusCode(500)); } }
public int CreateHouseAddress(TblHouseAddress model) { try { return(file.CreateHouseAddress(model)); } catch (Exception ex) { StaticHelper.LogException(path: up.GetLogFilePath(), errorMessage: ex.Message, methodName: $"Class Name: {nameof(FilePresenter)} - Method name: {nameof(CreateHouseAddress)}", stackTrace: ex.StackTrace); return(0); } }
public int CreateHouseAddress(TblHouseAddress model) { try { var IsHouseNoExists = dbContext.TblHouseAddress.Where(x => x.HouseNo == model.HouseNo && x.SectorId == model.SectorId).FirstOrDefault(); if (IsHouseNoExists != null) { return(0); } else { dbContext.Add(model); return(dbContext.SaveChanges()); } } catch (Exception ex) { StaticHelper.LogException(path: up.GetLogFilePath(), errorMessage: ex.Message, methodName: $"Repository name: {nameof(FileRepository)} - Method name: {nameof(CreateHouseAddress)}", stackTrace: ex.StackTrace); return(0); } }