Beispiel #1
0
        public async Task <ResultModel> CreateVehicleLocation(VehicleLocationVm vehicleLocationVm)
        {
            try
            {
                var entity = new Domain.Entities.VehicleLocation
                {
                    Latitude  = vehicleLocationVm.Latitude,
                    Longitude = vehicleLocationVm.Longitude,
                    TripDate  = vehicleLocationVm.TripDate,
                    TripTime  = vehicleLocationVm.TripTime,
                    Speed     = vehicleLocationVm.Speed,
                    Altitude  = vehicleLocationVm.Altitude,
                    VehicleId = vehicleLocationVm.VehicleId
                };


                await _context.VEHICLE_LOCATION.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{vehicleLocationVm.VehicleId}"),
                    Id = entity.VehicleLocationId.ToString()
                });
            }

            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{vehicleLocationVm.VehicleId}")
                });
            }
        }
Beispiel #2
0
        public async Task <ResultModel> CreateExpenseSubType(ExpenseSubTypeVm expenseSubTypeVm)
        {
            try
            {
                var entity = new ExpenseSubType
                {
                    ExpenseTypeId      = expenseSubTypeVm.ExpenseTypeId,
                    ExpenseSubTypeName = expenseSubTypeVm.ExpenseSubTypeName,


                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.L_EXPENSE_SUB_TYPE.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{expenseSubTypeVm.ExpenseSubTypeName}"),
                    Id = entity.ExpenseSubTypeId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{expenseSubTypeVm.ExpenseSubTypeName}")
                });
            }
        }
        public async Task <ResultModel> CreateExpense(ExpenseVm expenseVm)
        {
            try
            {
                var entity = new Expense
                {
                    ExpenseTypeId    = expenseVm.ExpenseTypeId,
                    ExpenseSubTypeId = expenseVm.ExpenseSubTypeId,
                    BillNo           = expenseVm.BillNo,
                    Quantity         = expenseVm.Quantity,
                    BillingDate      = expenseVm.BillingDate,
                    BillingAmount    = expenseVm.BillingAmount,
                    VehicleId        = expenseVm.VehicleId,


                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.EXPENSE.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{expenseVm.BillNo}"),
                    Id = entity.ExpenseId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{expenseVm.BillNo}")
                });
            }
        }
        public async Task <ResultModel> CreateBillPayment(BillPaymentVm billPaymentVm)
        {
            try
            {
                var entity = new BillPayment
                {
                    BillNo         = billPaymentVm.BillNo,
                    PaymentDate    = billPaymentVm.PaymentDate,
                    BillingAmount  = billPaymentVm.PaymentAmount,
                    DiscountAmount = billPaymentVm.DiscountAmount,
                    DueAmount      = billPaymentVm.DueAmount,
                    PaymentAmount  = billPaymentVm.PaymentAmount,


                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.BILL_PAYMENT.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{billPaymentVm.BillNo}"),
                    Id = entity.BillPaymentId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{billPaymentVm.BillNo}")
                });
            }
        }
Beispiel #5
0
        public async Task <ResultModel> CreateVehicle(VehicleVm vehicleVm)
        {
            try
            {
                var entity = new  Vehicle
                {
                    VehicleName      = vehicleVm.VehicleName,
                    ChassisNo        = vehicleVm.ChassisNo,
                    ModelNo          = vehicleVm.ModelNo,
                    ColorCode        = vehicleVm.ColorCode,
                    ProductionYear   = vehicleVm.ProductionYear,
                    RegistrationYear = vehicleVm.RegistrationYear,
                    ManufacturerId   = vehicleVm.ManufacturerId,
                    EngineCC         = vehicleVm.EngineCC,
                    CountryCode      = vehicleVm.CountryCode,
                    Remarks          = vehicleVm.Remarks,
                    ActiveStatus     = vehicleVm.ActiveStatus,

                    UpdateBy   = _currentUserService.UserId,
                    UpdateDate = _dateTime.Now,
                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.VEHICLE.AddAsync(entity);


                await _context.SaveChangesAsync();

                var data = new Owner
                {
                    OwnerName        = vehicleVm.Owner.OwnerName,
                    VehicleId        = entity.VehicleId,
                    JoiningDate      = vehicleVm.Owner.JoiningDate,
                    DateOfBirth      = vehicleVm.Owner.DateOfBirth,
                    NidNo            = vehicleVm.Owner.NidNo,
                    GenderId         = vehicleVm.Owner.GenderId,
                    PresentAddress   = vehicleVm.Owner.PresentAddress,
                    PermanentAddress = vehicleVm.Owner.PermanentAddress,
                    CountryCode      = vehicleVm.Owner.CountryCode,
                    Email            = vehicleVm.Owner.Email,
                    Deleted          = false
                };

                await _context.OWNER.AddAsync(data);

                await _context.SaveChangesAsync();



                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{vehicleVm.VehicleName}"),
                    Id = entity.VehicleId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{vehicleVm.VehicleName}")
                });
            }
        }