Exemplo n.º 1
0
        public HttpResponseMessage AddNewStore(string storeid, string storename, string phonenumber, string email, string address, string opeingtime, string closingtime, string localityid)
        {
            StoreModel model = new StoreModel();

            model.StoreId          = Convert.ToInt32(storeid);
            model.LocalityId       = Convert.ToInt32(localityid);
            model.StoreName        = storename;
            model.StorePhoneNumber = phonenumber;
            model.StoreEmailId     = email;
            model.StoreAddress     = address;
            model.OpeningTime      = Convert.ToDateTime(opeingtime);
            model.ClosingTime      = Convert.ToDateTime(closingtime);
            //model.StoreStatus = storestatus;
            //if (storestatus)
            //{
            //    model.StoreStatus  = "Y";
            //}
            //else
            //{
            //    model.StoreStatus = "N";
            //}

            ResponseStatus response = new ResponseStatus();

            try
            {
                var data = _repository.AddNewStore(model);
                //if (data.StoreId > 0)
                //{
                //    response.isSuccess = true;
                //    response.serverResponseTime = DateTime.Now;
                return(Request.CreateResponse(HttpStatusCode.OK, new { data }));
                //}
                //else
                //{
                //    response.isSuccess = false;
                //    response.serverResponseTime = DateTime.Now;
                //    return Request.CreateResponse(HttpStatusCode.BadRequest, new { data });
                //}
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Something Worng !", ex));
            }
        }