public JsonResult FileUpload([FromBody] FilesUpload filesUpload) { ActionsResult result = new ActionsResult() { Id = 0, Message = "Error" }; if (filesUpload.Files != null) { result = ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/ImageUpload", filesUpload); } return(Json(new { result })); }
public async Task <ActionsResult> Save(CreateRoomTypeFacilitiesApplyRequest facilitysApply) { try { var result = new ActionsResult(); foreach (var facility in facilitysApply.FacilitieIds) { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@FacilityId", int.Parse(facility)); parameters.Add("@RoomTypeId", facilitysApply.RoomTypeId); result = await SqlMapper.QueryFirstOrDefaultAsync <ActionsResult>(cnn : conn, sql : "FacilityApply_Save", param : parameters, commandType : CommandType.StoredProcedure); } return(result); } catch (Exception) { return(new ActionsResult() { Id = 0, Message = "Có lỗi xảy ra, xin thử lại!" }); } }
public async Task <ActionsResult> Save(UploadRoomTypeImagesRequest uploadRoomTypeImagesRequest) { try { var result = new ActionsResult(); foreach (var imgData in uploadRoomTypeImagesRequest.Images) { DynamicParameters parameters = new DynamicParameters(); parameters.Add("@RoomTypeId", uploadRoomTypeImagesRequest.RoomTypeId); parameters.Add("@ImageData", imgData); result = await SqlMapper.QueryFirstOrDefaultAsync <ActionsResult>(cnn : conn, sql : "RoomTypeImage_Save", param : parameters, commandType : CommandType.StoredProcedure); } return(result); } catch (Exception) { return(new ActionsResult() { Id = 0, Message = "Có lỗi xảy ra, xin thử lại!" }); } }
public JsonResult Save([FromBody] Booking model) { ActionsResult customerResult = ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/customer/save", model.BookingCustomer); model.CustomerId = customerResult.Id; ActionsResult result; result = ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/booking/save", model); foreach (var item in model.bookingServiceDetails) { item.BookingId = result.Id; ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/bookingServiceDetails/save", item); } foreach (var roomDetail in model.bookingRoomDetails) { roomDetail.BookingId = result.Id; ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/bookingRoomDetails/save", roomDetail); } model.BookingId = result.Id; ApiHelper <ActionsResult> .HttpPostAsync($"{Helper.ApiUrl}api/booking/save", model); return(Json(new { result })); }
public JsonResult DeleteByBookingId(int id) { ActionsResult result = ApiHelper <ActionsResult> .HttpGetAsync($"{Helper.ApiUrl}api/bookingServiceDetails/deletebyBookingId/{id}", "DELETE"); return(Json(new { result })); }
public JsonResult Delete(int id) { ActionsResult result = ApiHelper <ActionsResult> .HttpGetAsync($"{Helper.ApiUrl}api/facilities/delete/{id}", "DELETE"); return(Json(new { result })); }
public JsonResult DeleteByPromotionId(int id) { ActionsResult result = ApiHelper <ActionsResult> .HttpGetAsync($"{Helper.ApiUrl}api/promotionapply/deletebypromotionid/{id}", "DELETE"); return(Json(new { result })); }
public JsonResult DeleteByRoomTypeId(int id) { ActionsResult result = ApiHelper <ActionsResult> .HttpGetAsync($"{Helper.ApiUrl}api/facilityapply/deletebyroomtypeid/{id}", "DELETE"); return(Json(new { result })); }