public IActionResult createDisplayFiles(createDisplayFiles createDisplayFiles) { try { List <createDisplay> displayList = new List <createDisplay>(); if (createDisplayFiles.displayId <= 0 || createDisplayFiles.displayId == null) { return(StatusCode((int)HttpStatusCode.BadRequest, new { ErrorMessage = "Please enter displayId" })); } else if (createDisplayFiles.filePath == "" || createDisplayFiles.filePath == null) { return(StatusCode((int)HttpStatusCode.BadRequest, new { ErrorMessage = "Please upload filePath" })); } int row = Data.Display.createDisplayFiles(createDisplayFiles); if (row > 0) { return(StatusCode((int)HttpStatusCode.OK, "Created DisplayFiles Successfully")); } else { return(StatusCode((int)HttpStatusCode.InternalServerError, new { ErrorMessage = "Error while Updating the DisplayFiles" })); } } catch (Exception e) { string SaveErrorLog = Data.Common.SaveErrorLog("createDisplayFiles", e.Message); return(StatusCode((int)HttpStatusCode.InternalServerError, new { ErrorMessage = e.Message })); } }
public static int createDisplayFiles(createDisplayFiles createDisplayFiles) { try { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@displayId", createDisplayFiles.displayId)); parameters.Add(new SqlParameter("@filePath", createDisplayFiles.filePath)); parameters.Add(new SqlParameter("@latitude", createDisplayFiles.latitude)); parameters.Add(new SqlParameter("@longitude", createDisplayFiles.longitude)); parameters.Add(new SqlParameter("@country", createDisplayFiles.country)); parameters.Add(new SqlParameter("@state", createDisplayFiles.state)); parameters.Add(new SqlParameter("@cityName", createDisplayFiles.cityName)); parameters.Add(new SqlParameter("@address", createDisplayFiles.address)); string ConnectionString = Common.GetConnectionString(); int rowsAffected = SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "spSaveDisplayFiles", parameters.ToArray()); return(rowsAffected); } catch (Exception e) { throw e; } }