Exemplo n.º 1
0
        public string updateMechanic(MechanicVM model)
        {
            var entity = _dbContext.Mechanics.Find(model.Id);

            if (model != null)
            {
                entity.Name    = model.Name;
                entity.Mobile  = model.Mobile;
                entity.EmailId = model.EmailId;
                _dbContext.SaveChanges();
            }
            return(entity.ToString());
        }
Exemplo n.º 2
0
        public MechanicVM getMechanicyId(int Id)
        {
            var        entity = _dbContext.Mechanics.Find(Id);
            MechanicVM model  = new MechanicVM();

            if (entity != null)
            {
                model.Id      = entity.Id;
                model.Name    = entity.Name;
                model.Mobile  = entity.Mobile;
                model.EmailId = entity.EmailId;
            }
            return(model);
        }
Exemplo n.º 3
0
        public List <MechanicVM> getallMechanic()
        {
            var entities = _dbContext.Mechanics.ToList();
            List <MechanicVM> mechanicdata = new List <MechanicVM>();

            if (entities != null)
            {
                foreach (var item in entities)
                {
                    MechanicVM mechanicmodels = new MechanicVM();
                    mechanicmodels.Id      = item.Id;
                    mechanicmodels.Name    = item.Name;
                    mechanicmodels.Mobile  = item.Mobile;
                    mechanicmodels.EmailId = item.EmailId;
                    mechanicdata.Add(mechanicmodels);
                }
            }
            return(mechanicdata);
        }
Exemplo n.º 4
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("");
        }
Exemplo n.º 5
0
 public string updateMechanic(MechanicVM model)
 {
     return(_mechanicRepository.updateMechanic(model));
 }