public IHttpActionResult PutAddressType(int id, AddressType addressType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != addressType.Id) { return(BadRequest()); } //db.Entry(addressType).State = EntityState.Modified; //_genericService.AddOrUpdate<AddressType>(addressType); if (!AddressTypeExists(id)) { return(NotFound()); } else { _genericService.AddOrUpdate <AddressType>(addressType); } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit(ManufacturerDTO manufacturer) { if (ModelState.IsValid) { manufacturerService.AddOrUpdate(manufacturer); return(RedirectToAction("IndexHtmlAction")); } return(View("Edit")); }
public ActionResult Edit(TasteCategoryDTO tasteCategory) { if (ModelState.IsValid) { tasteCategoryService.AddOrUpdate(tasteCategory); return(RedirectToAction("IndexHtmlAction")); } return(View("Edit")); }
public ActionResult Create([Bind(Include = "Id,FirstName,LastName,PictureUrl,BirthDay")] Person person) { if (ModelState.IsValid) { //db.People.Add(person); //db.SaveChanges(); //_personService.AddOrUpdate(person); _genericService.AddOrUpdate <Person>(person); string url = Url.Action("ListPeople", "People"); return(Json(new { success = true, url = url, target = "#idContact" })); } return(PartialView("_Create", person)); }
public ActionResult Edit(ApartmentDTO apartment) { if (ModelState.IsValid) { apartmentService.AddOrUpdate(apartment); return(RedirectToAction("Index")); } return(View(apartment)); }
public ActionResult Edit(UnitDTO unit) { if (ModelState.IsValid) { unitService.AddOrUpdate(unit); return(RedirectToAction("IndexHtmlAction")); } return(View("Edit")); }
public ActionResult Edit(OrderDTO order) { if (ModelState.IsValid) { orderService.AddOrUpdate(order); return(RedirectToAction("IndexHtmlAction")); } return(View("Edit")); }
public ActionResult Edit(DeliveryDTO delivery) { if (ModelState.IsValid) { deliveryService.AddOrUpdate(delivery); return(RedirectToAction("IndexHtmlAction")); } return(View("Edit")); }
public ActionResult Edit(UtilityDTO utility) { if (ModelState.IsValid) { utilityService.AddOrUpdate(utility); return(RedirectToAction("Index")); } return(View(utility)); }
public ActionResult Edit(BenefitDTO benefit) { if (ModelState.IsValid) { benefitService.AddOrUpdate(benefit); return(RedirectToAction("Index")); } return(View(benefit)); }
/// <summary> /// Add new item in the table or update the existing one. /// These operations work asynchronously. /// </summary> public async static Task <TDtoElement> AddOrUpdateAsync <TDbElement, TDtoElement, TKey> ( this IGenericService <TDbElement, TDtoElement, TKey> service, TDtoElement item ) where TDbElement : class where TDtoElement : class { return(await Task.Run(() => service.AddOrUpdate(item))); }
public ActionResult Edit(ProductDTO product) { if (ModelState.IsValid) { productService.AddOrUpdate(product); // return RedirectToAction("Index"); // return RedirectToAction("Edit", "ProductPrice", new { area = " " }); return(RedirectToAction("IndexHtmlAction")); } return(View("Edit")); }
void CreateWallets(GameDto game) { var resources = m_resourceService.GetAll(); foreach (var resource in resources) { var wallet = new ResourceWalletDto { GameId = game.GameId, ResourceId = resource.ResourceId }; m_walletService.AddOrUpdate(wallet); } }
public IHttpActionResult PutPhoneType(int id, PhoneType phoneType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != phoneType.Id) { return(BadRequest()); } if (!PhoneTypeExists(id)) { return(NotFound()); } else { _genericService.AddOrUpdate <PhoneType>(phoneType); } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutPerson(int id, Person person) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != person.Id) { return(BadRequest()); } if (!_genericService.Exists <Person>(id)) { return(NotFound()); } else { _genericService.AddOrUpdate <Person>(person); } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit(ProductPriceDTO productPrice) { if (ModelState.IsValid) { if (productPrice.SubCategoryId == 0) { productPrice.SubCategoryId = null; } if (productPrice.TasteCategoryId == 0) { productPrice.TasteCategoryId = null; } productPriceService.AddOrUpdate(productPrice); return(RedirectToAction("IndexHtmlAction")); } return(View("Edit")); }
/// <summary> /// Create rate for each resource of the given collection in DB. /// </summary> /// <returns> /// The list of the inserted rates. /// </returns> public List <TradingResourceRateDto> CreateResourcesRates(GameDto game, List <TradingResourceDto> resources) { m_rateGenerator.GameId = game.GameId; m_rateGenerator.MoveNumber = game.CurrentMoveNumber; var rates = new List <TradingResourceRateDto>(); foreach (var resource in resources) { var rate = m_rateGenerator.GenerateRate(resource); var insertedRate = m_resourceService.AddOrUpdate(rate); rates.Add(insertedRate); } return(rates); }
public ActionResult UploadPhoto(IEnumerable <HttpPostedFileBase> fileUpload) { string Id = Request.Params["id"]; foreach (var item in fileUpload) { PhotoDTO photo = new PhotoDTO { PhotoId = 0, PathPhoto = "/Images/" + item.FileName, ProductId = Convert.ToInt32(Id) // }; photoService.AddOrUpdate(photo); string path = Path.Combine(Server.MapPath("~/Images/"), item.FileName); item.SaveAs(path); } // return RedirectToAction("Details", "ProductPrice", new { id = Convert.ToInt32(Id) }); return(RedirectToAction("Edit", "Product", new { id = Convert.ToInt32(Id) })); }
public async Task <ActionResult> Register(RegisterModel model) { ViewBag.Apartments = new SelectList(apartmentService.GetAll().Select(ap => new SelectListItem { Value = ap.ApartmentNumber.ToString(), Text = ap.ApartmentNumber.ToString() }), "Value", "Text"); if (ModelState.IsValid) { var user = new AppUser { Email = model.Email, UserName = model.Email, PhoneNumber = model.PhoneNumber, ApartmentNumber = model.ApartmnentNumber }; ApartmentDTO apartment = apartmentService.FindBy(ap => ap.ApartmentNumber == user.ApartmentNumber).FirstOrDefault(); if (apartment.Username != null) { ModelState.AddModelError("", "Ця квартира вже має зареєстрованого користувача"); return(View(model)); } var result = await userManager.CreateAsync(user, model.Password); if (result.Succeeded) { apartment.Username = user.UserName; apartmentService.AddOrUpdate(apartment); await userManager.AddToRoleAsync(user.Id, "OSBB_User"); TempData["user"] = user; return(RedirectToAction("VerifyUser")); } AddErrors(result); } return(View(model)); }
public ActionResult Edit(CustomerInfo info) { Cart cart = GetCartMy(); OrderDTO tmp; if (User.Identity.GetUserId() != null) { tmp = new OrderDTO() { UserId = User.Identity.GetUserId(), //UserId = "Anonim", DateCreateOrder = DateTime.Now, DateCreateGood = DateTime.Now.AddDays(3),//за 3 дня заказ DeliveryId = 1, StatusId = 1, UserName = info.Name, UserPhone = info.Phone, UserEmail = info.Email, Total = 0 // }; } else { tmp = new OrderDTO() { // UserId = User.Identity.GetUserId(), UserId = "Anonim", DateCreateOrder = DateTime.Now, DateCreateGood = DateTime.Now.AddDays(3),//за 3 дня заказ DeliveryId = 1, StatusId = 1, UserName = info.Name, UserPhone = info.Phone, UserEmail = info.Email, Total = 0 // }; } OrderDTO order = orderService.AddOrUpdate(tmp); int _total = 0; string _order = ""; foreach (var el in cart.Lines) { OrderPositionDTO orderPos = new OrderPositionDTO() { OrderId = order.OrderId, ProductId = el.ProductPricecart.ProductId, OrderCount = el.Quantity, OrderPosPrice = el.ProductPricecart.Price, // OrderPosAmount = (el.Quantity) * (int)(el.ProductPricecart.Price), // }; orderPositionService.AddOrUpdate(orderPos); _total += orderPos.OrderPosAmount; _order += el.ProductPricecart.GoodName + " - " + el.Quantity + " шт " + " по " + (int)el.ProductPricecart.Price + " грн " + " - " + orderPos.OrderPosAmount + "грн <br>"; } order.Total = _total;// OrderDTO ordernew = orderService.AddOrUpdate(order); string _customer = "<h3> Добрый день, " + info.Name + "! </h3>" + " Заказ № " + ordernew.OrderId + " от " + ordernew.DateCreateOrder + " отправлен на обработку. <br>" + _order + " Итого " + _total + " грн. <br>" + " В ближайшее время вам перезвонит менеджер для уточнения деталей. <br>" + "_________________________________________________________________ <br>" + " Интернет магазин <a href=\"http://anysite.ru\"> BigCake.somee.com </a>,<br>" + " [email protected],<br>" + " т.066-200-00-00"; string _manager = "<h3> Добрый день ! </h3> " + "Покупатель ожидает звонка. <br>" + "Имя: " + info.Name + "<br>" + "почта: " + info.Email + "<br>" + "телефон: " + info.Phone + "<br>" + "Заказ № " + ordernew.OrderId + " от " + ordernew.DateCreateOrder + " отправлен на обработку. <br>" + _order + " Итого " + _total + " грн. <br>"; string _manageremail = "*****@*****.**"; SendLetterAfterOrder(ordernew.UserEmail, _customer); SendLetterAfterOrder(_manageremail, _manager); cart.Clear();//очистить return(RedirectToAction("Index", "Category")); }