Example #1
0
        public async Task <IActionResult> DeleteCost(int id)
        {
            if (await CostExists(id))
            {
                await _costRepository.Delete(id);

                return(NoContent());
            }
            else
            {
                return(NotFound());
            }
        }
Example #2
0
        public IHttpActionResult Delete(int Id)
        {
            if (Id == 0)
            {
                return(BadRequest("Cant Delete data"));
            }
            var cost = costRepository.GetById(Id);

            if (cost == null)
            {
                return(BadRequest("Cant Delete data"));
            }
            costRepository.Delete(cost);
            unitOfWork.Commit();
            return(Ok("Data deleted successfully"));
        }