public IActionResult ParkingType([FromBody] ParkingTypeModel parking) { try { var result = this.business.ParkingTypes(parking); if (result != null) { return(this.Ok(new { Status = true, message = "Parking Data Added sucesfully", data = result })); } return(this.BadRequest(new { Status = false, message = "Error while Adding Parking Data" })); } catch (Exception e) { return(this.NotFound(new { Status = false, message = e.Message })); } }
/// <summary> /// Parking types. /// </summary> /// <param name="parking">The parking.</param> /// <returns></returns> /// <exception cref="Exception">Error While Adding Parking Data" + e.Message</exception> public ParkingTypeModel ParkingTypes(ParkingTypeModel parking) { try { parkingContext.ParkingTypeTable.Add(parking); var result = parkingContext.SaveChanges(); if (result > 0) { return(parking); } return(null); } catch (Exception e) { throw new Exception("Error While Adding Parking Data" + e.Message); } }
public ParkingTypeModel ParkingTypes(ParkingTypeModel parking) { var result = userRepo.ParkingTypes(parking); return(result); }