public async Task <IActionResult> PutWorkShift(Guid id, WorkShift workShift)
        {
            if (id != workShift.ShiftId)
            {
                return(BadRequest());
            }

            _repoWrapper.WorkShift.Update(workShift);

            try
            {
                await _repoWrapper.save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkShiftExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutEmployee(Guid id, Employee employee)
        {
            if (id != employee.EmployeeId)
            {
                return(BadRequest());
            }

            _repoWrapper.Employee.UpdateEmployee(employee);

            try
            {
                await _repoWrapper.save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 3
0
        public async Task <IActionResult> PutCompany(Guid id, Company company)
        {
            if (id != company.BranchId)
            {
                return(BadRequest());
            }

            _repoWrapper.Company.UpdateCompany(company);

            try
            {
                await _repoWrapper.save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CompanyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutAttendance(Guid id, Attendance attendance)
        {
            if (id != attendance.AttendanceId)
            {
                return(BadRequest());
            }

            _repoWrapper.Attendance.UpdateAttendance(attendance);

            try
            {
                await _repoWrapper.save();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AttendanceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public void createTweet(LciTweets tweet)
        {
            try
            {
                List <LciCategory> objCategory = RepoWrapper.Category.FindAll();

                List <LciSubcategory> objSubCategory = RepoWrapper.SubCategory.FindAll();

                int categoryId = GetCategoryId(tweet.Tweettext, objCategory, objSubCategory);

                //if(categoryId ==0)
                // categoryId = GetSubCategoryId(tweet.Tweettext, objSubCategory);
                tweet.Categoryid = categoryId;
                RepoWrapper.Tweet.Create(tweet);
                RepoWrapper.save();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 public void Post(User user)
 {
     using (MD5 md5Hash = MD5.Create())
     {
         String _password         = Common.GetMd5Hash(md5Hash, user.Password);
         String _doubleEncryption = Common.GetMd5Hash(md5Hash, _password);
         user.Password = _doubleEncryption;
         user.RoleId   = 2;
         _repoWrapper.User.Create(user);
         _repoWrapper.save();
     }
 }
 public void Post(Employee emp)
 {
     _repositoryWrapper.Employee.Create(emp);
     _repositoryWrapper.save();
 }