public StandardRequestResultModel DeleteItemFromItemRequest(ItemToItemRequestModel item) { var checkQuery = _itemRequestFormDataAccess.ValidateIfMappingExists(item.ItemId, item.ItemRequestId); StandardRequestResultModel result = new StandardRequestResultModel(); if (checkQuery == null) { result.isSuccess = false; result.Message = "Item does not exist in Item Request."; return(result); } else { var deleteQuery = _itemRequestFormDataAccess.DeleteItemFromItemRequest(checkQuery.Id); if (deleteQuery) { result.isSuccess = true; result.Message = "Item successfully removed from Item Request."; } else { result.isSuccess = false; result.Message = "Error occured while removing Item from Item Request."; } return(result); } }
public IHttpActionResult DeleteItemFromItemRequest([FromBody] ItemToItemRequestModel item) { var container = ContainerConfig.Configure(); using (var scope = container.BeginLifetimeScope()) { var app = scope.Resolve <IItemRequestFormBusinessLayer>(); var result = app.DeleteItemFromItemRequest(item); return(Json(result)); } }
public StandardRequestResultModel AttachItemToItemRequest(ItemToItemRequestModel item) { var checkQuery = _itemRequestFormDataAccess.ValidateIfMappingExists(item.ItemId, item.ItemRequestId); StandardRequestResultModel result = new StandardRequestResultModel(); if (checkQuery != null) { result.isSuccess = false; result.Message = "Item already exists in Item Request."; return(result); } else { ItemRequestFormMapping query = new ItemRequestFormMapping(); query.ItemID = item.ItemId; query.IRFID = item.ItemRequestId; query.CreateUserName = "******"; query.CreateDttm = DateTime.UtcNow; query.UpdateUserName = "******"; query.UpdateDttm = DateTime.UtcNow; var addQuery = _itemRequestFormDataAccess.AttachItemToItemRequest(query); if (addQuery) { result.isSuccess = true; result.Message = "Item added to Item Request."; } else { result.isSuccess = false; result.Message = "Error while adding Item to Item Request."; } return(result); } }