Beispiel #1
0
        public async Task <ResultModel> DeleteVehicleLocation(int id)
        {
            if (id > 0)
            {
                var entity = await _context.VEHICLE_LOCATION.FirstOrDefaultAsync(x => x.VehicleId == id && x.Deleted == false);

                if (entity != null)
                {
                    entity.Deleted = true;
                    await _context.SaveChangesAsync();

                    return(new ResultModel {
                        Result = true, Message = NotificationConfig.DeleteSuccessMessage($"{entity.VehicleId}")
                    });
                }
                else
                {
                    return(new ResultModel {
                        Result = false, Message = NotificationConfig.NotFoundError
                    });
                }
            }
            else
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.NotFoundMessage($"{id}")
                });
            }
        }
        public async Task <ResultModel> DeleteExpense(int id)
        {
            if (id > 0)
            {
                var entity = await _context.EXPENSE.FirstOrDefaultAsync(x => x.ExpenseId == id && x.Deleted == false);

                if (entity != null)
                {
                    entity.Deleted = true;
                    await _context.SaveChangesAsync();

                    return(new ResultModel {
                        Result = true, Message = NotificationConfig.DeleteSuccessMessage($"{entity.BillNo}")
                    });
                }
                else
                {
                    return(new ResultModel {
                        Result = false, Message = NotificationConfig.NotFoundError
                    });
                }
            }
            else
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.NotFoundMessage($"{id}")
                });
            }
        }