// Create or Update public override string PostAction(string parameters, System.Collections.Specialized.NameValueCollection querystring, string postdata) { string data = string.Empty; string bvin = FirstParameter(parameters); ApiResponse<CategoryDTO> response = new ApiResponse<CategoryDTO>(); CategoryDTO postedCategory = null; try { postedCategory = MerchantTribe.Web.Json.ObjectFromJson<CategoryDTO>(postdata); } catch(Exception ex) { response.Errors.Add(new ApiError("EXCEPTION", ex.Message)); return MerchantTribe.Web.Json.ObjectToJson(response); } Category c = new Category(); c.FromDto(postedCategory); if (bvin == string.Empty) { if (MTApp.CatalogServices.Categories.Create(c)) { bvin = c.Bvin; } } else { MTApp.CatalogServices.Categories.Update(c); } Category resultCategory = MTApp.CatalogServices.Categories.Find(bvin); if (resultCategory != null) response.Content = resultCategory.ToDto(); data = MerchantTribe.Web.Json.ObjectToJson(response); return data; }