コード例 #1
0
 public string createCustomer(CustomerVM model)
 {
     try
     {
         if (model != null)
         {
             Database.Customer entity = new Database.Customer();
             entity.Name    = model.Name;
             entity.Address = model.Address;
             //entity.lo = model.Locality;
             entity.EmailId  = model.EmailId;
             entity.MobileNo = model.MobileNo;
             entity.City     = model.City;
             entity.State    = model.State;
             entity.Password = model.Password;
             entity.Zipcode  = model.Zipcode;
             _dbContext.Customers.Add(entity);
             _dbContext.SaveChanges();
             return("");
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
     return("");
 }
コード例 #2
0
 public string createDealer(DealerVM model)
 {
     if (model != null)
     {
         Database.Dealer dealer = new Database.Dealer();
         dealer.Name    = model.Name;
         dealer.Mobile  = model.Mobile;
         dealer.Address = model.Address;
         //dealer.Locality = model.Locality;
         dealer.Zipcode = model.Zipcode;
         dealer.Email   = model.Email;
         _dbContext.Dealers.Add(dealer);
         _dbContext.SaveChanges();
         return("");
     }
     return("");
 }
コード例 #3
0
        public string addVehicle(VehicleVM model)
        {
            if (model != null)
            {
                Database.Vehicle vehicledetail = new Database.Vehicle();
                vehicledetail.LicensePlate     = model.LicencePlate;
                vehicledetail.Make             = model.Make;
                vehicledetail.Model            = model.Model;
                vehicledetail.RegistrationDate = model.RegistrationDate;
                vehicledetail.ChassisNo        = model.ChassisNo;

                vehicledetail.OwnerId = model.OwnerId;
                _dbcontext.Vehicles.Add(vehicledetail);
                _dbcontext.SaveChanges();
                return("");
            }
            return("");
        }
コード例 #4
0
 public bool deleteBooking(int Id)
 {
     try
     {
         var entity = _dbcontext.AppointBookings.Find(Id);
         if (entity.Status != null)
         {
             var entities = _dbcontext.Entry(entity);
             entities.State = EntityState.Deleted;
             _dbcontext.SaveChanges();
             return(true);
         }
     }
     catch (Exception)
     {
         // return false;
     }
     return(false);
 }
コード例 #5
0
        public string createMechanic(MechanicVM model)
        {
            try
            {
                if (model != null)
                {
                    Database.Mechanic mechanicdetail = new Database.Mechanic();

                    mechanicdetail.Name    = model.Name;
                    mechanicdetail.Mobile  = model.Mobile;
                    mechanicdetail.EmailId = model.EmailId;
                    _dbContext.Mechanics.Add(mechanicdetail);
                    _dbContext.SaveChanges();
                    return("");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
            return("");
        }