internal Result AddBeverage(AddNewBeverage request) { try { context.Beverages.InsertOnSubmit(new Beverage() { AlcoholPercentage = request.alcaholPercent, DateCreated = DateTime.Now, ImageUrlSm = request.imageUrl, Name = request.name, MajorGroup = request.majorGroupId, Type = request.type, IpAddress = request.ipAddress, Accepted = false } ); context.SubmitChanges(); return(new Result(ResultStatus.SUCCESS, "Beverage created")); } catch (Exception ex) { return(new Result(ResultStatus.ERROR, ex.Message)); } }
public HttpResponseMessage AddBeverage(AddNewBeverage request) { request.ipAddress = GetUser_IP(); Result result = dal.AddBeverage(request); return(ApiTools.CreateResponse(result, Request)); }