Beispiel #1
0
        public async Task <ActionResult> AddEmployees(RegisterViewModel model)
        {
            TimesheetRepositrory c = new TimesheetRepositrory();

            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    //   await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                    c.UpdateRole(model.Role, model.Email);
                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    //  return RedirectToAction("Index", "Home");
                    ViewBag.msg = "Account Successfully Created..";
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
 public List <CompanyEmployees> GetCompanyEmployees()
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var result = _searchRepository.GetCompanyEmployees();
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool DeleteTimePeriods([FromBody] WorkingHours Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var Result = _searchRepository.DeleteTimePeriods(Model);
         return(Result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool AddCompanyEmployees([FromBody] CompanyEmployees Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var Result = _searchRepository.AddCompanyEmployees(Model);
         return(Result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public List <TimesheetModel> GetSubmittedTimeSheets()
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var result = _searchRepository.GetSubmittedTimeSheets();
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool SaveAdminTimeSheet([FromBody] WorkingHours Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var Result = _searchRepository.SaveAdminTimeSheet(Model);
         return(Result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public List <WorkingHours> GetTimeSheetDetails(WorkingHours Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var result = _searchRepository.GetTimeSheetDetails(Model.TimePeriodId);
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool SubmitTimeSheet([FromBody] TimesheetModel Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var Result = _searchRepository.SubmitTimeSheet(Model);
         return(Result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public List <TimesheetModel> GetTimePeriodsPerId(TimesheetModel Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var result = _searchRepository.GetTimePeriodsPerId(Model.UserName, Model.TimePeriodId);
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public bool AddTimePeriods([FromBody] TimesheetModel Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var Result = _searchRepository.AddTimePeriods(Model);
         return(Result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public List <ProjectModel> GetProjectsPerCompany(CompanyModel Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var result = _searchRepository.GetProjectsPerCompany(Model.CompanyId);
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public Employees CheckUser([FromBody] Employees s)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var result = _searchRepository.CheckUser(s);
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public List <CompanyModel> getCompanyPerEmp(Employees Model)
 {
     try
     {
         TimesheetRepositrory _searchRepository = new TimesheetRepositrory();
         var result = _searchRepository.getCompanyPerEmp(Model.Username);
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }