public ActionResult Update(DeviceLocations model)
        {
            try
            {
                var data = repository.Update(model);

                return(Ok(new { success = true, successMessage = "Updated Successfully!" }));
            }
            catch (Exception ex)
            {
                return(Ok(new { success = false, errorMessage = ex.GetBaseException() }));
            }
        }
        public DeviceLocations Save(DeviceLocations model)
        {
            try
            {
                model.Guid      = Guid.NewGuid().ToString().ToUpper();
                model.CreatedOn = DateTime.Now;
                model.UpdatedOn = DateTime.Now;

                context.Add(model);
                context.SaveChanges();

                return(model);
            }
            catch (System.Exception) {
                throw;
            }
        }
        public DeviceLocations Update(DeviceLocations model)
        {
            try
            {
                var result = context.DeviceLocation.Where(x => x.Id == model.Id).FirstOrDefault();

                result.LocationName  = model.LocationName;
                result.LocationLevel = model.LocationLevel;
                result.IsActive      = model.IsActive;
                result.UpdatedOn     = DateTime.Now;

                context.Entry(result).State = EntityState.Modified;
                context.SaveChanges();

                return(result);
            }
            catch (System.Exception)
            {
                throw;
            }
        }