public async Task <ResultModel> UpdateExpense(UpdateExpenseVm updateExpenseVm) { try { if (updateExpenseVm.ExpenseId > 0) { var entity = new Expense { ExpenseId = updateExpenseVm.ExpenseId, ExpenseTypeId = updateExpenseVm.ExpenseTypeId, ExpenseSubTypeId = updateExpenseVm.ExpenseSubTypeId, BillNo = updateExpenseVm.BillNo, Quantity = updateExpenseVm.Quantity, BillingDate = updateExpenseVm.BillingDate, BillingAmount = updateExpenseVm.BillingAmount, VehicleId = updateExpenseVm.VehicleId, UpdateBy = _currentUserService.UserId, UpdateDate = _dateTime.Now, }; _context.EXPENSE.Update(entity); await _context.SaveChangesAsync(); return(new ResultModel { Result = true, Message = NotificationConfig.UpdateSuccessMessage($"{updateExpenseVm.BillNo}"), Id = entity.ExpenseId.ToString() }); } else { return(new ResultModel { Result = false, Message = NotificationConfig.NotFoundMessage($"{updateExpenseVm.BillNo} ") }); } } catch (Exception) { return(new ResultModel { Result = false, Message = NotificationConfig.UpdateErrorMessage($"{updateExpenseVm.BillNo}") }); } }
public async Task <ResultModel> UpdateBillPayment(UpdateBillPaymentVm updateBillPaymentVm) { try { if (updateBillPaymentVm.BillPaymentId > 0) { var entity = new BillPayment { BillPaymentId = updateBillPaymentVm.BillPaymentId, BillNo = updateBillPaymentVm.BillNo, PaymentDate = updateBillPaymentVm.PaymentDate, BillingAmount = updateBillPaymentVm.PaymentAmount, DiscountAmount = updateBillPaymentVm.DiscountAmount, DueAmount = updateBillPaymentVm.DueAmount, PaymentAmount = updateBillPaymentVm.PaymentAmount, UpdateBy = _currentUserService.UserId, UpdateDate = _dateTime.Now, }; _context.BILL_PAYMENT.Update(entity); await _context.SaveChangesAsync(); return(new ResultModel { Result = true, Message = NotificationConfig.InsertSuccessMessage($"{updateBillPaymentVm.BillNo}"), Id = entity.BillPaymentId.ToString() }); } else { return(new ResultModel { Result = false, Message = NotificationConfig.NotFoundMessage($"{updateBillPaymentVm.BillNo} ") }); } } catch (Exception) { return(new ResultModel { Result = false, Message = NotificationConfig.UpdateErrorMessage($"{updateBillPaymentVm.BillNo}") }); } }
public async Task <ResultModel> UpdateExpenseSubType(UpdateExpenseSubTypeVm updateExpenseSubTypeVm) { try { if (updateExpenseSubTypeVm.ExpenseSubTypeId > 0) { var entity = new ExpenseSubType { ExpenseSubTypeId = updateExpenseSubTypeVm.ExpenseSubTypeId, ExpenseTypeId = updateExpenseSubTypeVm.ExpenseTypeId, ExpenseSubTypeName = updateExpenseSubTypeVm.ExpenseSubTypeName, UpdateBy = _currentUserService.UserId, UpdateDate = _dateTime.Now, }; _context.L_EXPENSE_SUB_TYPE.Update(entity); await _context.SaveChangesAsync(); return(new ResultModel { Result = true, Message = NotificationConfig.UpdateSuccessMessage($"{updateExpenseSubTypeVm.ExpenseSubTypeName}"), Id = entity.ExpenseSubTypeId.ToString() }); } else { return(new ResultModel { Result = false, Message = NotificationConfig.NotFoundMessage($"{updateExpenseSubTypeVm.ExpenseSubTypeName} ") }); } } catch (Exception) { return(new ResultModel { Result = false, Message = NotificationConfig.UpdateErrorMessage($"{updateExpenseSubTypeVm.ExpenseSubTypeName} ") }); } }
public async Task <ResultModel> UpdateVehicleLocation(UpdateVehicleLocationVm updateVehicleLocationVm) { try { if (updateVehicleLocationVm.VehicleLocationId > 0) { var entity = new Domain.Entities.VehicleLocation { VehicleLocationId = updateVehicleLocationVm.VehicleLocationId, Latitude = updateVehicleLocationVm.Latitude, Longitude = updateVehicleLocationVm.Longitude, TripDate = updateVehicleLocationVm.TripDate, TripTime = updateVehicleLocationVm.TripTime, Speed = updateVehicleLocationVm.Speed, Altitude = updateVehicleLocationVm.Altitude, VehicleId = updateVehicleLocationVm.VehicleId }; _context.VEHICLE_LOCATION.Update(entity); await _context.SaveChangesAsync(); return(new ResultModel { Result = true, Message = NotificationConfig.UpdateSuccessMessage($"{updateVehicleLocationVm.VehicleId}"), Id = entity.VehicleLocationId.ToString() }); } else { return(new ResultModel { Result = false, Message = NotificationConfig.NotFoundMessage($"{updateVehicleLocationVm.VehicleId} information") }); } } catch (Exception) { return(new ResultModel { Result = false, Message = NotificationConfig.UpdateErrorMessage($"{updateVehicleLocationVm.VehicleId}") }); } }
public async Task <ResultModel> UpdateVehicle(UpdateVehicleVm updateVehicleVm) { try { if (updateVehicleVm.VehicleId > 0) { var entity = new Vehicle { VehicleId = updateVehicleVm.VehicleId, VehicleName = updateVehicleVm.VehicleName, ChassisNo = updateVehicleVm.ChassisNo, ModelNo = updateVehicleVm.ModelNo, ColorCode = updateVehicleVm.ColorCode, ProductionYear = updateVehicleVm.ProductionYear, RegistrationYear = updateVehicleVm.RegistrationYear, ManufacturerId = updateVehicleVm.ManufacturerId, EngineCC = updateVehicleVm.EngineCC, CountryCode = updateVehicleVm.CountryCode, Remarks = updateVehicleVm.Remarks, ActiveStatus = updateVehicleVm.ActiveStatus, UpdateBy = _currentUserService.UserId, UpdateDate = _dateTime.Now, CreatedBy = _currentUserService.UserId, CreateDate = _dateTime.Now, }; _context.VEHICLE.Update(entity); var data = new Owner { OwnerId = updateVehicleVm.Owner.OwnerId, OwnerName = updateVehicleVm.Owner.OwnerName, VehicleId = entity.VehicleId, JoiningDate = updateVehicleVm.Owner.JoiningDate, DateOfBirth = updateVehicleVm.Owner.DateOfBirth, NidNo = updateVehicleVm.Owner.NidNo, GenderId = updateVehicleVm.Owner.GenderId, PresentAddress = updateVehicleVm.Owner.PresentAddress, PermanentAddress = updateVehicleVm.Owner.PermanentAddress, CountryCode = updateVehicleVm.Owner.CountryCode, Email = updateVehicleVm.Owner.Email, Deleted = false }; _context.OWNER.Update(data); await _context.SaveChangesAsync(); return(new ResultModel { Result = true, Message = NotificationConfig.UpdateSuccessMessage($"{updateVehicleVm.VehicleName}"), Id = entity.VehicleId.ToString() }); } else { return(new ResultModel { Result = false, Message = NotificationConfig.NotFoundMessage($"{updateVehicleVm.VehicleName} information") }); } } catch (Exception) { return(new ResultModel { Result = false, Message = NotificationConfig.UpdateErrorMessage($"{updateVehicleVm.VehicleName}") }); } }