Beispiel #1
0
        public IHttpActionResult PostEmployee(employee emp)
        {
            if (emp.Gender == "true")
            {
                emp.Gender = "Male";
            }
            else
            {
                emp.Gender = "Female";
            }

            if (emp.EmpId > 0)
            {
                db.Entry(emp).State = EntityState.Modified;
            }
            else
            {
                db.employees.Add(emp);
            }

            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                Ok("Failed");
            }
            return(Ok(emp));
        }
Beispiel #2
0
 public int Add(Device model)
 {
     _context.Devices.Add(model);
     return(_context.SaveChanges());
 }
Beispiel #3
0
 public void add(Device_Categories model)
 {
     _context.Device_Categories.Add(model);
     _context.SaveChanges();
 }
Beispiel #4
0
 public void add(Property_Items prop)
 {
     _context.Property_Items.Add(prop);
     _context.SaveChanges();
 }
Beispiel #5
0
 public void Add(Property_Options entity)
 {
     _context.Property_Options.Add(entity);
     _context.SaveChanges();
 }