public IActionResult AddUndergoes()
        {
            if (ModelState.IsValid)
            {
                if (AVM.Undergoes.Id == 0)
                {
                    _unitofWork.Undergoes.Add(AVM.Undergoes);
                }
                else
                {
                    _unitofWork.Undergoes.Update(AVM.Undergoes);
                }

                _unitofWork.Save();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AVM.DoctorsList    = _unitofWork.Doctors.GetDropDownListForDoctors();
                AVM.PatientsList   = _unitofWork.Patients.GetDropDownListForPatients();
                AVM.NursesList     = _unitofWork.Patients.GetDropDownListForPatients();
                AVM.UsageList      = _unitofWork.Usage.GetDropDownListForUsage();
                AVM.ProceduresList = _unitofWork.Procedure.GetDropDownListForProcedure();

                return(View(AVM));
            }
        }
Ejemplo n.º 2
0
 public void AddSeance(Seance seance)
 {
     //TODO : test existance Agent / candidate
     //      date's seance not in the past
     context.Seance.Create(seance);
     context.Save();
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(GradeCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var obj = new Grade
                {
                    id = model.id
                    ,
                    type = model.type

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.grade.Add(obj);
                bool res = _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(orderstatusIndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new orderstatus
                {
                    id = model.id
                    ,
                    type = model.type
                    , NotificationMsg = model.NotificationMsg

                    ,
                    isdeleted = false
                };

                _unitofWork.orderstatuss.Add(objcategory);
                _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(CountryRegistrationCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new CountryRegistration
                {
                    id = model.id
                    ,
                    countrycode = model.countrycode
                    ,
                    countryname = model.countryname

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.country.Add(objcategory);
                bool res = _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(bankmasterIndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new bankmaster
                {
                    id                = model.id,
                    bankname          = model.bankname,
                    bankifsccode      = model.bankifsccode,
                    bankbranch        = model.bankbranch,
                    accountno         = model.accountno,
                    accountholdername = model.accountholdername,
                    isdeleted         = false,
                    isactive          = false
                };

                _unitofWork.bankmaster.Add(objcategory);
                _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public async Task <IActionResult> Createmessage(string senderId, MessageCreateDTO messageCreateDTO)
        {
            var a = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            if (senderId != User.FindFirst(ClaimTypes.NameIdentifier).Value)
            {
                return(Unauthorized());
            }
            var receiver = await _unitofWork.PartnerFinder.GetUser(messageCreateDTO.ReceiverId);

            if (receiver == null)
            {
                return(BadRequest("receiver not found"));
            }
            var message = _mapper.Map <Message>(messageCreateDTO);

            _unitofWork.MessageRepository.Add(message);
            var result = await _unitofWork.Save();

            if (result == 0)
            {
                return(StatusCode(500, "saving probem"));
            }
            return(Ok());
        }
Ejemplo n.º 8
0
        public IActionResult AddTreatment()
        {
            if (ModelState.IsValid)
            {
                if (AVM.Treatment.Id == 0)
                {
                    _unitofWork.Treatment.Add(AVM.Treatment);
                }
                else
                {
                    _unitofWork.Treatment.Update(AVM.Treatment);
                }

                _unitofWork.Save();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AVM.DoctorsList    = _unitofWork.Doctors.GetDropDownListForDoctors();
                AVM.ProceduresList = _unitofWork.Procedure.GetDropDownListForProcedure();

                return(View(AVM));
            }
        }
        public IActionResult AddAppointment()
        {
            if (ModelState.IsValid)
            {
                if (AVM.Appointments.Id == 0)
                {
                    _unitofWork.Appointments.Add(AVM.Appointments);
                }
                else
                {
                    _unitofWork.Appointments.Update(AVM.Appointments);
                }

                _unitofWork.Save();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AVM.DoctorsList  = _unitofWork.Doctors.GetDropDownListForDoctors();
                AVM.PatientsList = _unitofWork.Patients.GetDropDownListForPatients();

                return(View(AVM));
            }
        }
        public async Task <IActionResult> Create(ExpenseIndexViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new Expense
                {
                    id = model.id
                    ,
                    Name = model.Name

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.expenses.Add(objcategory);
                _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
        public async Task <IActionResult> Create(packingTypeCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new packingType
                {
                    id = model.id
                    ,
                    name = model.name

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.packingType.Add(objcategory);
                bool res = _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 12
0
        public IActionResult AddAffiliated()
        {
            if (ModelState.IsValid)
            {
                if (AVM.Affiliated.Id == 0)
                {
                    _unitofWork.Affiliated.Add(AVM.Affiliated);
                }
                else
                {
                    _unitofWork.Affiliated.Update(AVM.Affiliated);
                }

                _unitofWork.Save();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AVM.DoctorsList     = _unitofWork.Doctors.GetDropDownListForDoctors();
                AVM.DepartmentsList = _unitofWork.Department.GetDropDownListForDepartments();

                return(View(AVM));
            }
        }
        public async Task <IActionResult> Create(productSizeUpsertViewModel model)
        {
            if (ModelState.IsValid)
            {
                var obj = new productSize
                {
                    id = model.id
                    ,
                    size = model.size

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.productSize.Add(obj);
                bool res = _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 14
0
        public IActionResult AddInventory()
        {
            if (ModelState.IsValid)
            {
                if (AVM.Inventory.Id == 0)
                {
                    _unitofWork.Inventory.Add(AVM.Inventory);
                }
                else
                {
                    _unitofWork.Inventory.Update(AVM.Inventory);
                }

                _unitofWork.Save();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AVM.BGroupList    = _unitofWork.BGroup.GetDropDownListForBGroup();
                AVM.HospitalsList = _unitofWork.Hospital.GetDropDownListForHospitals();
                AVM.BranchList    = _unitofWork.Branch.GetDropDownListBranch();

                return(View(AVM));
            }
        }
Ejemplo n.º 15
0
        public async Task <IActionResult> Create(StateRegistrationCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new StateRegistration
                {
                    id = model.id
                    ,
                    countryid = model.countryid
                    ,
                    StateName = model.StateName

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.state.Add(objcategory);
                bool res = _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                ViewBag.Allcountry = _unitofWork.country.GetAll().Where(x => x.isdeleted == false).Select(x => new SelectListItem()
                {
                    Text  = x.countryname,
                    Value = x.id.ToString()
                });
                return(View(model));
            }
        }
Ejemplo n.º 16
0
        public IActionResult AddRoomUsage()
        {
            if (ModelState.IsValid)
            {
                if (AVM.Usage.Id == 0)
                {
                    _unitofWork.Usage.Add(AVM.Usage);
                }
                else
                {
                    _unitofWork.Usage.Update(AVM.Usage);
                }

                _unitofWork.Save();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AVM.PatientsList = _unitofWork.Patients.GetDropDownListForPatients();
                AVM.RoomsList    = _unitofWork.Room.GetDropDownListForRoom();

                return(View(AVM));
            }
        }
        public IActionResult AddPerscribtion()
        {
            if (ModelState.IsValid)
            {
                if (AVM.Perscribtion.Id == 0)
                {
                    _unitofWork.Perscribtion.Add(AVM.Perscribtion);
                }
                else
                {
                    _unitofWork.Perscribtion.Update(AVM.Perscribtion);
                }

                _unitofWork.Save();

                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                AVM.DoctorsList     = _unitofWork.Doctors.GetDropDownListForDoctors();
                AVM.PatientsList    = _unitofWork.Patients.GetDropDownListForPatients();
                AVM.MedicationsList = _unitofWork.Medication.GetDropDownListForMedications();

                return(View(AVM));
            }
        }
Ejemplo n.º 18
0
        public IHttpActionResult Create([FromBody] CreateCustomerLotDTO createLot)
        {
            var currentLot = dataBase.Lots.Get(createLot.LotId);

            if (createLot.CustomerBet <= currentLot.CurrentPrice)
            {
                ModelState.AddModelError("CustomerBet",
                                         "Ваша ставка должна быть больше текущей!!!");
            }
            var customerCount = dataBase.CustomerLots.GetAll(User.Identity.Name).Where(cl => cl.LotId == createLot.LotId);

            if (customerCount.Count() != 0)
            {
                ModelState.AddModelError("Customer",
                                         "Вы уже участвуете в этом аукционе! Для повышения ставки перейдите в 'Мои лоты'");
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var customerLot     = Mapper.Map <CreateCustomerLotDTO, CustomerLot>(createLot);
            var currentCustomer = dataBase.Customers.GetByName(User.Identity.Name);

            customerLot.Lot      = currentLot;
            customerLot.Customer = currentCustomer;
            dataBase.CustomerLots.Create(customerLot);
            currentLot.CurrentPrice = customerLot.CustomerBet;
            dataBase.Lots.Update(currentLot);
            dataBase.Save();
            return(Created(new Uri(Request.RequestUri + "/" + customerLot.LotId), createLot));
        }
Ejemplo n.º 19
0
        public IActionResult OnPostOrderPrepare(int orderId)
        {
            OrderHeader orderHeader = _unitofWork.OrderHeader.GetFirstOrDefault(o => o.Id == orderId);

            orderHeader.Status = SD.StatusInProcess;
            _unitofWork.Save();
            return(RedirectToPage("ManageOrder"));
        }
Ejemplo n.º 20
0
        //to increment the no. of items in the cart
        public IActionResult OnPostPlus(int cartId)
        {
            var cart = _unitofWork.ShoppingCart.GetFirstOrDefault(c => c.Id == cartId);

            _unitofWork.ShoppingCart.IncrementCount(cart, 1);
            _unitofWork.Save();
            return(RedirectToPage("/Members/Cart/Index"));
        }
Ejemplo n.º 21
0
        public IActionResult OnPostOrderConfirm(int orderId)
        {
            OrderHeader orderHeader = _unitofWork.OrderHeader.GetFirstOrDefault(o => o.Id == orderId);

            orderHeader.Status = SD.StatusCompleted;
            _unitofWork.Save();
            return(RedirectToPage("OrderList"));
        }
Ejemplo n.º 22
0
        public IActionResult CreateMainCategory([FromBody] MainCategoryInsertDtos mainCategoryInsertDtos)
        {
            if (mainCategoryInsertDtos == null)
            {
                return(BadRequest(ModelState));
            }
            if (_unitofWork.mainCategory.MainCategoryExists(mainCategoryInsertDtos.name))
            {
                ModelState.AddModelError("", "Main Category Exists!");
                return(StatusCode(404, ModelState));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var mainCategoryObj = _mapper.Map <MainCategory>(mainCategoryInsertDtos);

            if (mainCategoryInsertDtos.img == null || mainCategoryInsertDtos.img.Trim() == "")
            {
                mainCategoryObj.img = "";
            }
            else
            {
                var    rootFolder = Directory.GetCurrentDirectory();
                var    path       = rootFolder.ToString().Replace(".API", "");
                string fileName   = Guid.NewGuid().ToString();
                fileName = DateTime.UtcNow.ToString("yymmssfff") + fileName + ".jpg";
                var    folderPath = path + @"\wwwroot\uploads\MainCategory";
                string s          = Path.Combine(folderPath, fileName);
                if (!System.IO.Directory.Exists(folderPath))
                {
                    System.IO.Directory.CreateDirectory(folderPath);
                }
                System.IO.File.WriteAllBytes(Path.Combine(folderPath, fileName), Convert.FromBase64String(mainCategoryInsertDtos.img));
                mainCategoryObj.img = "/uploads/MainCategory/" + fileName;
            }


            mainCategoryObj.isdeleted = false;
            mainCategoryObj.isactive  = false;

            _unitofWork.mainCategory.Add(mainCategoryObj);
            // bool res = _unitofWork.Save();
            // return Ok(mainCategoryObj);


            if (!_unitofWork.Save())
            {
                ModelState.AddModelError("", $"Something went wrong saving record");
                return(StatusCode(500, ModelState));
            }
            // return CreatedAtRoute("GetMainCategory", new {   maincategoryId = mainCategoryObj.id }, mainCategoryObj);
            return(CreatedAtRoute("GetMainCategory", new { Version = HttpContext.GetRequestedApiVersion().ToString(), maincategoryId = mainCategoryObj.id }, mainCategoryObj));
        }
Ejemplo n.º 23
0
        public IActionResult Approved(int?id)
        {
            var reqFromDb = _unitofWork.Request.Get(id.GetValueOrDefault());

            reqFromDb.Status = SD.Pending;

            _unitofWork.Request.Update(reqFromDb);
            _unitofWork.Save();

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 24
0
        /// <summary>
        /// register
        /// </summary>
        /// <param name="accModel"></param>
        public void CreateAccount(CreateAccViewModel accModel)
        {
            accModel.RoleId      = (int)Role.User;
            accModel.CreateDate  = DateTime.Now;
            accModel.ExpiredDate = DateTime.Now;
            accModel.Type        = (int)UserType.None;
            var user = _mapper.Map <CreateAccViewModel, User>(accModel);

            _unitofWork.UserBaseService.Add(user);
            _unitofWork.Save();
        }
Ejemplo n.º 25
0
 /// <summary>
 /// create or edit user
 /// </summary>
 /// <param name="userDto"></param>
 /// <exception cref="NotImplementedException"></exception>
 public void Save(CreateUserViewModel userDto)
 {
     if (userDto.Id <= 0)
     {
         var user = _mapper.Map <CreateUserViewModel, User>(userDto);
         user.CreateDate  = DateTime.Now;
         user.ExpiredDate = DateTime.Now;
         user.Type        = (int)UserType.None;
         _unitofWork.UserBaseService.Add(user);
         _unitofWork.Save();
     }
 }
 public void DeleteStudentCourseService(StudentCourse studentCourse)
 {
     try
     {
         _unitofWork._studentCourseRepo.DeleteStudentCourseRepo(studentCourse);
         _unitofWork.Save();
     }
     catch (Exception e)
     {
         throw new Exception("Error " + e.Message);
     }
 }
 public void DeleteStudentService(Student student)
 {
     try
     {
         _unitofWork._studentsRepo.DeleteStudentRepo(student);
         _unitofWork.Save();
     }
     catch (Exception e)
     {
         throw new Exception("Error: " + e.Message);
     }
 }
Ejemplo n.º 28
0
        public async Task <ActionResult> UpdateBasicInformation([FromBody] BasicInformationDtos model)//[FromBody] BasicInformationDtos model,
        {
            if (model == null)
            {
                return(BadRequest());
            }
            var obj = _unitofWork.applicationUser.GetAll().Where(x => x.Id == model.Id).FirstOrDefault();

            //  var obj = _db.ApplicationUser.Where(x => x.Id == model.Id).FirstOrDefault();

            if (obj == null)
            {
                return(NotFound());
            }
            else
            {
                obj.name               = model.name;
                obj.companyName        = model.companyName;
                obj.cityid             = model.cityid;
                obj.businessYear       = model.businessYear;
                obj.productDealin      = model.productDealin;
                obj.ExportToCountries  = model.ExportToCountries;
                obj.userlatitude       = model.userlatitude;
                obj.userlongitude      = model.userlongitude;
                obj.packHouselatitude  = model.packHouselatitude;
                obj.packHouselongitude = model.packHouselongitude;
                obj.packHouseAddress   = model.packHouseAddress;
                obj.deviceid           = model.deviceid;
                obj.isBasicInfoFill    = model.isBasicInfoFill;
            }
            if (model.logo == null || model.logo.Trim() == "")
            {
                // obj.logo = "";
            }
            else
            {
                SaveImageinFolder objsaveImageinFolder = new SaveImageinFolder();
                string            iamgename            = objsaveImageinFolder.uploadImage(obj.logo, "\\uploads\\user\\documentation", model.logo);
                obj.logo = iamgename;
            }

            var result = await _userManager.UpdateAsync(obj);

            if (!_unitofWork.Save())
            {
                ModelState.AddModelError("", $"Something went wrong saving record");
                return(StatusCode(500, ModelState));
            }
            var Dtosobj = new BasicInformationDtos();

            Dtosobj = _mapper.Map <BasicInformationDtos>(obj);
            return(Ok(Dtosobj));
        }
 public void DeleteInstructor(int id)
 {
     try
     {
         _unitofWork._instructorRepo.DeleteInstructorRepo(
             _unitofWork._instructorRepo.GetInstructorRepo(id));
         _unitofWork.Save();
     }
     catch (Exception e)
     {
         throw new Exception("Error: " + e.Message);
     }
 }
Ejemplo n.º 30
0
        public IActionResult saveProduct([FromBody] ProductViewModelDtos model)
        {
            if (model == null)
            {
                return(BadRequest(ModelState));
            }
            var checkduplicate = _unitofWork.product.GetAll().Where(x => x.userId == model.userId && x.subCategoryId == model.subCategoryId && x.isdeleted == false).FirstOrDefault();

            if (checkduplicate != null)
            {
                ModelState.AddModelError("", "Product Exists!");
                return(StatusCode(404, ModelState));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            //DateTime dateFromString =model.rateTill;
            DateTime dt3        = new DateTime(2015, 12, 31, 5, 10, 20);
            var      objProduct = _mapper.Map <Product>(model);

            //objProduct.rateTill = dt3;
            //  objProduct.isdeleted = false;
            _unitofWork.product.Add(objProduct);
            if (!_unitofWork.Save())
            {
                ModelState.AddModelError("", $"Something went wrong saving record");
                return(StatusCode(500, ModelState));
            }



            IEnumerable <ProductDetailsViewModelDtos> objproductDetailsViewModelDtos = model.productDetailsViewModelDtos;

            foreach (var item in objproductDetailsViewModelDtos)
            {
                var objProductdetails = _mapper.Map <ProductDetails>(item);
                objProductdetails.pid = objProduct.id;
                _unitofWork.productDetails.Add(objProductdetails);
            }


            if (!_unitofWork.Save())
            {
                ModelState.AddModelError("", $"Something went wrong saving record");
                return(StatusCode(500, ModelState));
            }
            return(Ok(model));
            // return CreatedAtRoute("GetMainCategory", new { Version = HttpContext.GetRequestedApiVersion().ToString(), maincategoryId = mainCategoryObj.id }, mainCategoryObj);
        }